﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ViewModels="clr-namespace:ScrumSprintMonitor.Modules.WorkItemMonitor.ViewModels"
                    xmlns:Controls="clr-namespace:ScrumSprintMonitor.Modules.WorkItemMonitor.Controls"
                    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                    xmlns:il="clr-namespace:Microsoft.Expression.Interactivity.Layout;assembly=Microsoft.Expression.Interactions">

	<ResourceDictionary.MergedDictionaries>
		<ResourceDictionary Source="TeamMemberBadgeDataTemplate.xaml" />
	</ResourceDictionary.MergedDictionaries>

	<DataTemplate x:Key="OnlineDataTemplate">
		<Grid>
			<Controls:SprintWarningBorder />

			<ScrollViewer VerticalScrollBarVisibility="Disabled" VerticalAlignment="Stretch" Margin="0,0,0,6">
				<ItemsControl ItemsSource="{Binding TeamMembersIncludingUnassigned}" Focusable="False">
					<ItemsControl.ItemsPanel>
						<ItemsPanelTemplate>
							<UniformGrid Columns="{Binding NumberOfColumnsInGridView}">
								<i:Interaction.Behaviors>
									<il:FluidMoveBehavior Duration="0:0:4" AppliesTo="Children">
										<il:FluidMoveBehavior.EaseX>
											<QuarticEase EasingMode="EaseInOut" />
										</il:FluidMoveBehavior.EaseX>
										<il:FluidMoveBehavior.EaseY>
											<QuarticEase EasingMode="EaseInOut" />
										</il:FluidMoveBehavior.EaseY>
									</il:FluidMoveBehavior>
								</i:Interaction.Behaviors>
							</UniformGrid>
						</ItemsPanelTemplate>
					</ItemsControl.ItemsPanel>
					<ItemsControl.ItemContainerStyle>
						<Style TargetType="FrameworkElement">
							<Setter Property="Margin" Value="6,6,6,0" />
						</Style>
					</ItemsControl.ItemContainerStyle>
				</ItemsControl>
			</ScrollViewer>
		</Grid>
	</DataTemplate>

	<DataTemplate DataType="{x:Type ViewModels:TeamMembersListViewModel}">
		<ContentPresenter Content="{Binding}" Focusable="False">
			<ContentPresenter.Style>
				<Style TargetType="{x:Type ContentPresenter}">
					<Setter Property="ContentTemplate">
						<Setter.Value>
							<DataTemplate />
						</Setter.Value>
					</Setter>

					<Style.Triggers>
						<DataTrigger Binding="{Binding Path=HasException}" Value="False">
							<Setter Property="ContentTemplate" Value="{StaticResource OnlineDataTemplate}" />
						</DataTrigger>
					</Style.Triggers>
				</Style>
			</ContentPresenter.Style>
		</ContentPresenter>
	</DataTemplate>
</ResourceDictionary>